export function setCookie(val, value, expire) {
    var date = new Date()
    date.setSeconds(date.getSeconds() + expire)
    document.cookie = val + "=" + escape(value) + "; expires=" + date.toGMTString()
}

export function getCookie(val) {
    if (document.cookie.length > 0) {
        let str = document.cookie.indexOf(val + "=")
        if (str !== -1) {
            str = str + val.length + 1
            let offover = document.cookie.indexOf(";", str)
            if (offover === -1) offover = document.cookie.length
            return unescape(document.cookie.substring(str, offover))
        }
    }
    return ""
}

export function delCookie(val) {
    setCookie(val, "", -1)
}